﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.IO;

namespace ServerVideoCall
{
    public partial class Login : Form
    {
        private frmUpdate _frmUpdate;
        private frmServer server = new frmServer();

        DataProvider DuLieu = new DataProvider();
        
        public Login(frmUpdate frm)
        {
            server.Send += new frmServer.ServerSend(server_Send);
            InitializeComponent();
            _frmUpdate = frm;
        }
        void server_Send(string data)
        {
            if (data == "Exit")
                this.Close();
        }
        private void pictureBox1_Click(object sender, EventArgs e)
        {
            int kq = DuLieu.CheckAdmin(txtus.Text, txtps.Text);
            if (kq != 2)
            {
                server.ROLE = kq;
                server.Show();
                this.Visible = false;
            }
            else
                MessageBox.Show("UserName - Password Không Hợp Lệ", "VideoCall-SendMessage ()", MessageBoxButtons.OK, MessageBoxIcon.Error);
        }
        private void Login_Load(object sender, EventArgs e)
        {

        }
        private void Login_FormClosed(object sender, FormClosedEventArgs e)
        {
            _frmUpdate.Close();
        }
    }
}
